Vpa.doc.Method = function(cmt){
    Vpa.apply(this,{
        isPrivate : cmt.isPrivate,
        isIgnored : cmt.isIgnored,
        shortDesc : cmt.description.getShort(),
        description : cmt.description,
        isStatic : cmt.isStatic,
        name : "",
        "return" : null,
        params : [],
        href : cmt.sourceHref,
        html_filename : cmt.sourceFileName
    });
    
    this.name = this.getName(cmt);
    
    var returnTag = cmt.getTag("return");
    if(returnTag){
        this["return"] = {
            type : returnTag.type,
            description : returnTag.description
        };
    }
    
    var params = cmt.getTags("param");
    for(var i=0,len=params.length;i<len;i++){
        this.params.push(new Vpa.doc.Param(params[i]));
    }
};

Vpa.doc.Method.prototype = {
    _RegExp_fun_info :
        /\s*(\S+?)(?=[\s:=;])\s*[:=;]?\s*(\S*?)(?=[\s:=;\(])/
    ,
    getName : function(cmt){
        var tag = cmt.getTag("method");
        if(tag && tag.methodName.length>0){
            return tag.methodName;
        }

        //guess what the function-name is;
        if(this._RegExp_fun_info.test(cmt.sourceCode.trim())){
            var str1 = RegExp.$1,
                str2 = RegExp.$2;
            if(str1 != 'var' && str1 != "function")
                return str1.substring(str1.lastIndexOf('.')+1);
            else
                return str2;
        }
        return '';
    }
}
